#!/bin/bash

# Script to restore ZODB
# 
# 
#Options for -R/--recover:
#   -D str
#   --date=str
#       Recover state as of this date.  Specify UTC (not local) time.
#           yyyy-mm-dd[-hh[-mm[-ss]]]
#       By default, current time is used.
#
#   -o filename
#   --output=filename
#       Write recovered ZODB to given file.  By default, the file is
#       written to stdout.
#
SERVERNAME="caja17.fis.usal.es"
SOURCE="/home/pablin/Escritorio/Nueva" #"/usr/local/Plone/Backups"
ASOFDATETIME="" # "-D 2007-03-25-02" # "-D yyyy-mm-dd[-hh[-mm[-ss]]]" Specify UTC (not local) time.
DESTINATION="/home/pablin/Escritorio/Copy.fs" #"/usr/local/Plone/Copy.fs"  # This is called Copy.fs for safety, to avoid overwriting the original
DBRESTORE="/usr/local/Plone/zinstance/bin/repozo -Rv -r ${SOURCE} ${ASOFDATETIME} -o ${DESTINATION}"
PYTHONPATH=/usr/local/Plone/Zope-2.10.7-final-py2.4/lib/python
export PYTHONPATH # otherwise repozo.py will probably not be able to find its libraries


# Restore Data.fs to target directory using repozo.py -R

echo "Restoring backup for \"${SERVERNAME}\""

`${DBRESTORE}`

echo "backup: Restoring backup for \"${SERVERNAME}\" is complete"

exit 0
